#!/usr/bin/env bash

db_name=trending_topic_alpha
topic_reads_schema=(\
    "id     varchar(32),"\
    "reads  bigint,"\
    "timestamp  varchar(10)")
initial_topics_bk_schema=(\
    "id     varchar(32),"\
    "link   varchar(500),"\
    "reads  bigint,"\
    "name   varchar(500),"\
    "timestamp varchar(10)")
initial_topics_schema=(\
    "id     varchar(32),"\
    "link   varchar(500),"\
    "reads  bigint,"\
    "name   varchar(500)")

psql $db_name <<__EOF
    drop table if exists topic_reads;
    drop table if exists initial_topics;
    drop table if exists initial_topics_bk;
    create table topic_reads (${topic_reads_schema[@]});
    create table initial_topics (${initial_topics_schema[@]});
    create table initial_topics_bk (${initial_topics_bk_schema[@]});
__EOF

